home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / bcsrce2.zip / CHEKBOX3.BC < prev    next >
Text File  |  1990-10-18  |  3KB  |  121 lines

  1. ansi
  2. let %!a = %1
  3. if %!a# = # goto ERROR
  4. let %!z = %!a
  5. gt %!z 21
  6. if errorlevel 1 goto ERROR
  7. if %!a = 0 Let %!a = 10
  8. goto TEST1
  9. :TEST1
  10. let %!b = %2
  11. if %!b# = # goto ERROR
  12. let %!z = %!b
  13. gt %!z 65
  14. if errorlevel 1 goto ERROR
  15. if %!b = 0 Let %!b = 30
  16. let %!p = %3
  17. if %!p# = # let %!p = y
  18. lower %!p
  19. if %!p = yes let %!p = y
  20. if %!p = y let %!e = 1
  21. if %!p = no let %!p = n
  22. if %!p = n let %!e = 1
  23. if not %!e@ = 1@ goto ERROR
  24. if %!p = y GOSUB YES
  25. if %!p = n GOSUB NO
  26. goto CHOOSE
  27. :YES
  28. locate %!a %!b
  29. echonolf ╔═════╗   ┌─────┐
  30. let %!s = %!a
  31. add %!s 1
  32. locate %!s %!b
  33. echonolf ║ Yes ║   │ No! │
  34. add %!s 1
  35. locate %!s %!b
  36. echonolf ╚═════╝   └─────┘
  37. return
  38. :NO
  39. locate %!a %!b
  40. echonolf ┌─────┐   ╔═════╗
  41. let %!s = %!a
  42. add %!s 1
  43. locate %!s %!b
  44. echonolf │ Yes │   ║ No! ║
  45. add %!s 1
  46. locate %!s %!b
  47. echonolf └─────┘   ╚═════╝
  48. return
  49. :CHOOSE
  50. rem 3840=Shift tab, 121=y, 110=n, 89=Y, 78=N, 27=Esc, 13=Enter, 9=Tab
  51. rem Left arrow=19200, Right arrow=19712
  52. getkey
  53. if errlevel 19712 GOTO ARROW
  54. if errlevel 19200 GOTO ARROW
  55. if errlevel 3840 GOTO ARROW
  56. if errlevel 121 GOTO MAKEYES
  57. if errlevel 110 GOTO MAKENO
  58. if errlevel 89 GOTO MAKEYES
  59. if errlevel 78 GOTO MAKENO
  60. if errlevel 27 Let %!d = 0
  61. if errlevel 27 GOTO END
  62. if errlevel 13 GOTO ENTER
  63. if errlevel 9 GOTO ARROW
  64. goto CHOOSE
  65. :ARROW
  66. if %!p = y GOTO YES_NO
  67. if %!p = n GOTO NO_YES
  68. goto CHOOSE
  69. :YES_NO
  70. GOSUB NO
  71. let %!p = n
  72. goto CHOOSE
  73. :NO_YES
  74. GOSUB YES
  75. let %!p = y
  76. goto CHOOSE
  77. :ENTER
  78. if %!p = y GOTO MAKEYES
  79. if %!p = n GOTO MAKENO
  80. :MAKEYES
  81. GOSUB YES
  82. let %!d = 2
  83. GOTO END
  84. :MAKENO
  85. GOSUB NO
  86. let %!d = 1
  87. GOTO END
  88. :SYNTAX
  89. echo.
  90. echo       SYNTAX---:  CHEKBOX [ROW(1-21)] [COLUMN(1-65)] [yes]/[no]
  91. echo       USAGE----:  Use in .BAT programs to interreact with users. Program-
  92. echo                   mer positions a yes/no check box at given row/column
  93. echo                   coordinates. An option is provided to preselect either
  94. echo                   yes or no. The default is CHEKBOX 10 30 yes.
  95. echo                   You can choose the defaults by using CHEKBOX 0 0 so long
  96. echo                   as they are not out of alignment. In other words, yes or
  97. echo                   no MUST be the third parameter, parameter two cannot ex-
  98. echo                   ceed 65, and parameter one must be less than 22. User
  99. echo                   has these keypresses to choose from left/right cursor,
  100. echo                   tab, shift tab, Enter, ESCape, Y, y, N, and n.
  101. echo.
  102. echo       EXAMPLE--:  CHECKBOX 17 30 no
  103. echo       EXAMPLE--:  CHEKBOX 5 0  {column 30 and yes is defaulted to}
  104. echo       EXAMPLE--:  CHEKBOX 0 0  {row 10, column 30 and yes is defaulted to}
  105. echo                   Only the yes/no can be omitted.
  106. echo.
  107. echo     Dependent upon user's choice, ERRORLEVEL is returned: Yes = 2,
  108. echo     NO = 1, ESCape = 0  [use IF ERRORLEVEL # GOTO LABEL for testing it].
  109. echo.
  110. echo       Public Domain BATCOM program example, 1990, by Felix A. Rozewicz
  111. goto END
  112. :ERROR
  113. echo  Unable to verify validity of first 2 primary parameters.
  114. echo  Or, there is an error in typing yes/no parameter.
  115. beep
  116. echo.
  117. waitkey 2
  118. goto SYNTAX
  119. :END
  120. EXIT %!d
  121.